package com.example.activity;

import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Slf4j
public class EventActivityInstance implements ActivityInstance {
    private static final Map<String, Object> ATTRIBUTES = new ConcurrentHashMap<>();

    @Override
    public void start() {
        this.updateAttribute("status", "start");
        log.info("start attributes: {}", ATTRIBUTES);

    }

    @Override
    public Map<String, Object> info() {
        return ATTRIBUTES;
    }

    @Override
    public void addAttribute(String key, Object value) {
        ATTRIBUTES.put(key, value);
    }

    @Override
    public Object getAttribute(String key) {
        return ATTRIBUTES.get(key);
    }

    @Override
    public void removeAttribute(String key) {
        ATTRIBUTES.remove(key);
    }

    @Override
    public void updateAttribute(String key, Object newValue) {
        ATTRIBUTES.put(key, newValue);
    }

}